/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.baladaboa.ws.core;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Leone
 */
@Entity
@Table(name = "evento", catalog = "dbbaladaboa", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Evento.findAll", query = "SELECT e FROM Evento e"),
    @NamedQuery(name = "Evento.findByIdevento", query = "SELECT e FROM Evento e WHERE e.idevento = :idevento"),
    @NamedQuery(name = "Evento.findByNomeEvento", query = "SELECT e FROM Evento e WHERE e.nomeEvento = :nomeEvento"),
    @NamedQuery(name = "Evento.findByDataEvento", query = "SELECT e FROM Evento e WHERE e.dataEvento = :dataEvento"),
    @NamedQuery(name = "Evento.findByHora", query = "SELECT e FROM Evento e WHERE e.hora = :hora"),
    @NamedQuery(name = "Evento.findByFlgVendaOnline", query = "SELECT e FROM Evento e WHERE e.flgVendaOnline = :flgVendaOnline")})
public class Evento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idevento", nullable = false)
    private Integer idevento;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 80)
    @Column(name = "nome_evento", nullable = false, length = 80)
    private String nomeEvento;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 2147483647)
    @Column(name = "descricao", nullable = false, length = 2147483647)
    private String descricao;
    @Basic(optional = false)
    @NotNull
    @Column(name = "data_evento", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dataEvento;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hora", nullable = false)
    @Temporal(TemporalType.TIME)
    private Date hora;
    @Basic(optional = false)
    @NotNull
    @Column(name = "flg_venda_online", nullable = false)
    private boolean flgVendaOnline;
    @JoinColumn(name = "tipo_evento_idtipo_evento", referencedColumnName = "idtipo_evento", nullable = false)
    @ManyToOne(optional = false)
    private TipoEvento tipoEventoIdtipoEvento;
    @JoinColumn(name = "casa_idcasa", referencedColumnName = "idcasa", nullable = false)
    @ManyToOne(optional = false)
    private Casa casaIdcasa;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "eventoIdevento")
    private List<PrecoEvento> precoEventoList;

    public Evento() {
    }

    public Evento(Integer idevento) {
        this.idevento = idevento;
    }

    public Evento(Integer idevento, String nomeEvento, String descricao, Date dataEvento, Date hora, boolean flgVendaOnline) {
        this.idevento = idevento;
        this.nomeEvento = nomeEvento;
        this.descricao = descricao;
        this.dataEvento = dataEvento;
        this.hora = hora;
        this.flgVendaOnline = flgVendaOnline;
    }

    public Integer getIdevento() {
        return idevento;
    }

    public void setIdevento(Integer idevento) {
        this.idevento = idevento;
    }

    public String getNomeEvento() {
        return nomeEvento;
    }

    public void setNomeEvento(String nomeEvento) {
        this.nomeEvento = nomeEvento;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Date getDataEvento() {
        return dataEvento;
    }

    public void setDataEvento(Date dataEvento) {
        this.dataEvento = dataEvento;
    }

    public Date getHora() {
        return hora;
    }

    public void setHora(Date hora) {
        this.hora = hora;
    }

    public boolean getFlgVendaOnline() {
        return flgVendaOnline;
    }

    public void setFlgVendaOnline(boolean flgVendaOnline) {
        this.flgVendaOnline = flgVendaOnline;
    }

    public TipoEvento getTipoEventoIdtipoEvento() {
        return tipoEventoIdtipoEvento;
    }

    public void setTipoEventoIdtipoEvento(TipoEvento tipoEventoIdtipoEvento) {
        this.tipoEventoIdtipoEvento = tipoEventoIdtipoEvento;
    }

    public Casa getCasaIdcasa() {
        return casaIdcasa;
    }

    public void setCasaIdcasa(Casa casaIdcasa) {
        this.casaIdcasa = casaIdcasa;
    }

    @XmlTransient
    public List<PrecoEvento> getPrecoEventoList() {
        return precoEventoList;
    }

    public void setPrecoEventoList(List<PrecoEvento> precoEventoList) {
        this.precoEventoList = precoEventoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idevento != null ? idevento.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Evento)) {
            return false;
        }
        Evento other = (Evento) object;
        if ((this.idevento == null && other.idevento != null) || (this.idevento != null && !this.idevento.equals(other.idevento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.baladaboa.ws.core.Evento[ idevento=" + idevento + " ]";
    }
    
}
